#!/usr/bin/env python3
# -*- coding: utf-8 -*-
##############################################
# @Author: DengLibin 榆霖
# @Date: Create in 2022-03-07 15:49:48
# @Description: 使用urllib
##############################################
'module name'
__author__ = 'DengLibin'
import asyncio
#if __name__ == '__main__':
from urllib.request import urlopen

url = 'http://www.baidu.com'

def run():
    with urlopen(url) as resp:
        with open('baidu.html', 'wb') as f:
            while True:
                buf =  resp.read(1024)
                if buf:
                    f.write(buf)
                else:
                    print('完成.........')
                    break

if __name__ == '__main__':
    run()
        
    